package com.byzk.p2p.admin.money.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.byzk.p2p.admin.borrow.dto.UserTender;
import com.byzk.p2p.admin.money.dto.BorrowPaymentDetail;
import com.byzk.p2p.admin.money.vo.BorrowPaymentDetailVo;
import com.byzk.p2p.admin.money.vo.HfBorrowPaymentDetailVo;

/**
 * 借款人明细表	dao层
 * @author suker.zhou
 *
 */
public interface BorrowPaymentDetailDao {
	
    public Integer deleteByPrimaryKey(Integer id);

    public Integer insert(BorrowPaymentDetail record);

    public Integer batchinsert(List<BorrowPaymentDetail> record);
    
    public Integer update(BorrowPaymentDetail record);
    
    public Integer batchUpdate(List<BorrowPaymentDetail> record);

    public BorrowPaymentDetailVo selectByPrimaryKey(Integer id);

    public Integer count(BorrowPaymentDetailVo vo);
	
	public List<BorrowPaymentDetailVo> list(BorrowPaymentDetailVo vo);
	
	public List<BorrowPaymentDetailVo> detailByBorrowIdAndUserId(@Param("tenderId") Integer tenderId,@Param("borrowId") Integer borrowId,@Param("userId") Integer userId);
	
	/**
	 * 用户贷款未还记录
	 * @param borrowId 借款标id
	 * @param userId 用户id
	 * @return
	 */
	public List<BorrowPaymentDetailVo> borrowDetail(@Param("borrowId") Integer borrowId,@Param("userId") Integer userId );
	
	public List<BorrowPaymentDetail> selectByPidAndIndex(@Param("paymentId")Integer paymentId);
	
	public List<BorrowPaymentDetail> selectByBorrowId(@Param("borrowId")Integer borrowId);
	
	public List<BorrowPaymentDetail> getByBorrowId(@Param("id")Integer id,@Param("index")Integer index);
	
	public BorrowPaymentDetailVo getBorrowDetail(@Param("borrowId") Integer borrowId,@Param("userId") Integer userId,@Param("pid") Integer pid);
	
	public Double feeCount(Integer userId);
	
	public List<BorrowPaymentDetailVo> selectByBorrowIdAndIndex(@Param("bid")Integer bid,@Param("index")Integer index);
	
	public List<HfBorrowPaymentDetailVo> selectByPaymentId(@Param("paymentId")Integer paymentId);
	
	public List<BorrowPaymentDetail> getDetailListByBorrowIdAndTenderId(@Param("borrowId")Integer borrowId, @Param("tenderId")Integer tenderId);

	public List<BorrowPaymentDetailVo> lastAwaitBorrow(@Param("userId") Integer userId,@Param("num")Integer num);
	
	public Double sumAwaitFundByUserId(Integer userId);
	
	public Double sumAwaitInterestByUserId(Integer userId);
	
	public List<BorrowPaymentDetailVo> lastAwaitChangeBorrow(@Param("userId") Integer userId,@Param("num")Integer num);
	
	/**
	 * 
	* <p>Description:查询透支用户转让的标的利息 </p>
	* <p>Company:xbd </p>
	* @author:lilei
	* @date:2016年10月31日上午11:47:43
	 */
	public Double sumNotPaymentInterestByTidAndBorrowId(BorrowPaymentDetail detail);
	
	
	/**
	 * Description:根据paymentId查询还款明细
	 * @auther:fdq
	 * @date :2016年11月24日
	 */
	public List<BorrowPaymentDetail> selectDetailByPaymentId(@Param("paymentId")Integer paymentId);
	
	public Integer countRepaymentByUserId(BorrowPaymentDetailVo vo);
	
	public List<BorrowPaymentDetailVo> myRepaymentList(BorrowPaymentDetailVo vo);
}